package com.lineage.server.model.skill.skillmode;

import com.lineage.server.model.Instance.L1NpcInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.model.L1Character;
import com.lineage.server.model.L1Magic;
import com.lineage.server.serverpackets.S_SkillSound;
import com.lineage.server.serverpackets.ServerBasePacket;

public class MIND_BREAK extends SkillMode {
  public int start(L1PcInstance srcpc, L1Character cha, L1Magic magic, int integer) throws Exception {
    int reMp = 5;
    int reMp2 = 0;
    int sp = srcpc.getSp();
    double dmg = sp * 3.8D;
    srcpc.sendPacketsAll((ServerBasePacket)new S_SkillSound(cha.getId(), 6553));
    if (srcpc.getlogpcpower_SkillFor2() > 0)
      reMp2 = srcpc.getlogpcpower_SkillFor2() * 20; 
    if (cha instanceof L1PcInstance) {
      L1PcInstance pc = (L1PcInstance)cha;
      int newMp = pc.getCurrentMp() - 5 - reMp2;
      if (newMp < 0)
        newMp = 0; 
      pc.setCurrentMp(newMp);
      pc.receiveDamage((L1Character)srcpc, dmg + reMp2, false, false);
    } else if (cha instanceof com.lineage.server.model.Instance.L1MonsterInstance || cha instanceof com.lineage.server.model.Instance.L1SummonInstance || 
      cha instanceof com.lineage.server.model.Instance.L1PetInstance) {
      L1NpcInstance npc = (L1NpcInstance)cha;
      int newMp = npc.getCurrentMp() - 5;
      if (newMp < 0)
        newMp = 0; 
      npc.setCurrentMp(newMp);
      npc.receiveDamage((L1Character)srcpc, (int)dmg + reMp2);
    } 
    return 0;
  }
  
  public int start(L1NpcInstance npc, L1Character cha, L1Magic magic, int integer) throws Exception {
    int dmg = 0;
    return 0;
  }
  
  public void start(L1PcInstance srcpc, Object obj) throws Exception {}
  
  public void stop(L1Character cha) throws Exception {}
}
